package siac.com.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import siac.com.configuracao.ConexaoHibernate;
import siac.com.entity.AuthOperacao;


public class AuthOperacaoDao extends AbstractHibernateDao<AuthOperacao> {
	public AuthOperacaoDao() {
		super(AuthOperacao.class);
	}

	@Override
	protected Session getSession() {
		return ConexaoHibernate.getSessionFactory().getCurrentSession();
	}

	public List<AuthOperacao> findCode(Object code) {
		Query query = this.getSession().getNamedQuery("AuthOperacao.findByCode");
		query.setParameter("code", code);
		return query.list();
	}

	public List<AuthOperacao> findName(Object name) {
		Query query = this.getSession().getNamedQuery("AuthOperacao.findByCode");
		query.setParameter("operacao", name);
		return query.list();
	}

	public List<AuthOperacao> findStatus(Object status) {
		Query query = this.getSession().getNamedQuery("AuthOperacao.findByStatus");
		query.setParameter("status", status);
		return query.list();
	}

	public List<AuthOperacao> findByAccao(Object accao) {
		Query query = this.getSession().getNamedQuery("AuthOperacao.findByAccao");
		query.setParameter("accao", accao);
		return query.list();
	}

	public List<AuthOperacao> findBySistema(Object sistema) {
		Query query = this.getSession().getNamedQuery("AuthOperacao.findBySistema");
		query.setParameter("sistema", sistema);
		return query.list();
	}

	public List<AuthOperacao> findByTipoOperacao(Object tipoOperacao) {
		Query query = this.getSession().getNamedQuery("AuthOperacao.findByTipoOperacao");
		query.setParameter("tipoOperacao", tipoOperacao);
		return query.list();
	}
	
}
